﻿using PSAMMatrixCloud.TransferSecret.PSAMMatrix;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace PSAMMatrixCloud.PSAMSecret
{
    public partial class PMSScecretService : ServiceBase
    {
        public static void RunAsService()
        {
            ServiceBase.Run(new PMSScecretService());
        }

        public PMSScecretService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            try
            {
                PSAMSocket.Start();//启动与psam加密盒子通讯服务
                PSAMMatrixCloud.TransferSecret.LaneMutual.LaneServer.RunAsync().Wait();//启动云端车道后台服务
                
            }
            catch (Exception ex)
            {
                Common.LogHelper.Error("服务启动运行异常",ex);
            }
        }

        protected override void OnStop()
        {
            Common.LogHelper.Info("服务停止运行");
        }
    }
}
